#include <QDebug>
#include "StatusBar.h"
#include "ui_StatusBar.h"
#include "Include/IconProvider.h"

StatusBar::StatusBar(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::StatusBar)
{
    ui->setupUi(this);
    ui->closeBtn->setIcon(IconProvider::instance()->icon("window-close"));
    ui->lblModified->hide();
    connect(ui->closeBtn, SIGNAL(clicked()), SLOT(onCloseClicked()));
}

StatusBar::~StatusBar()
{
    delete ui;
}

void StatusBar::setCursorPosition(int line, int index)
{
    ui->lblCol->setText(QString::number(index));
    ui->lblLine->setText(QString::number(line));
}

void StatusBar::setFileName(const QString & fileName)
{
    ui->lblFileName->setText(fileName);
}

void StatusBar::setModified(bool m)
{
    ui->lblModified->setVisible(m);
}

void StatusBar::onCloseClicked()
{
    emit closeRequest();
}
